{% extends "base.html" %}
{% block body %}
<script src="/static/d3.js"></script>

<div class="card border border-dark shadow" id="commandFrequencies" style="margin-top:5px">
    <div class="card-header border border-dark bg-header text-white shadow">
        <h2>Command Usage <span class="operator">Frequencies</span></h2>
    </div>
    <div class="card-body bg-card-body border border-dark shadow" style="padding:0">
        <div class="card-columns" style="column-count:2">
            <div>
                <div class="card-header shadow border border-dark"><h5>Payload Type Usage</h5></div>
                <div id="payload_type_usage"></div>
            </div>
            <div>
                <div class="card-header shadow border border-dark"><h5>Operator Interactions</h5></div>
                <div id="operator_usage"></div>
            </div>
        </div>
        <div class="card-columns" style="column-count:3">
            <template v-for="p in selected_frequencies">
                <div class="card bg-card-body border border-dark shadow">
                    <div class="card-header shadow border border-dark"><h6>[[ p['name'] ]]</h6></div>
                    <div :id="'operator_command_usage_' + p['id']" class="operator_specific"></div>
                </div>
            </template>
        </div>
    </div>
</div>
<br>
<div class="card border border-dark shadow" id="callbackAnalysis">
    <div class="card-header border border-dark bg-header text-white">
        <h2><span class="operator">Callbacks</span> Overview</h2>
    </div>
    <div class="card-body bg-card-body border border-dark" style="padding:0">
        <div class="card-columns" style="column-count:2">
            <div>
                <div class="card-header shadow border border-dark"><h5>Unique Hosts</h5></div>
                <div id="callbacks_by_host_vis"></div>
            </div>
            <div>
                <div class="card-header shadow border border-dark"><h5>Unique Users</h5></div>
                <div id="callbacks_by_user_vis"></div>
            </div>
        </div>
        <div class="card-columns" style="column-count:1">
             <div>
                <svg id="callback_timeline"></svg>
            </div><br>
        </div>
    </div>
</div>
<br>

<div class="card border border-dark shadow" id="artifactOverview">
    <div class="card-header border border-dark bg-header text-white">
        <h2><span class="operator">Artifact</span> Instances Overview</h2>
    </div>
    <div class="card-body bg-card-body border border-dark shadow" style="padding:0">
        <div class="card-columns" style="column-count:2">
             <div>
                <div class="card-header shadow border border-dark"><h5>Target Artifacts - Total: [[ artifacts.artifact_counts['total_count'] ]]</h5></div>
                <div id="target_artifacts"></div>
            </div>
            <div>
                <div class="card-header shadow border border-dark"><h5>File Statistics</h5></div>
                <div id="file_artifacts"></div>
            </div>
        </div>
        <div class="card-columns" style="column-count:3">
            <template v-for="p in payload_frequencies">
                <div class="card bg-card-body border border-dark shadow">
                    <div class="card-header shadow border border-dark"><h6>[[ p['name'] ]] - [[ selected_artifact ]]</h6></div>
                    <div :id="'payload_command_usage_' + p['id']" class="payload_artifact_specific"></div>
                </div>
            </template>
        </div>
    </div>
</div>
<br>
<div class="card border border-dark shadow" id="taskOverview">
    <div class="card-header border border-dark bg-header text-white">
        <h2><span class="operator">Tasking</span> Timeline</h2>
    </div>
    <div class="card-body bg-card-body border border-dark shadow" style="padding:0">
        <div class="card-columns" style="column-count:1">
             <div id="task_graph_div">
                <svg id="task_timeline"></svg>
            </div><br>
        </div>
    </div>
</div>
<br>
<div class="card border border-dark shadow" id="EventOverview">
    <div class="card-header border border-dark bg-header text-white">
        <h2><span class="operator">Eventing</span> Overview</h2>
    </div>
    <div class="card-body bg-card-body border border-dark shadow" style="padding:0">
        <div class="card-columns" style="column-count:2">
            <div>
                <div class="card-header shadow border border-dark"><h5>EventLog Overview</h5></div>
                <div id="event_overview"></div>
            </div>
            <div>
                <div class="card-header shadow border border-dark"><h5>
                    <template v-if="operator !== ''">
                        [[operator]] Specific Overview
                    </template>
                    <template v-else>
                        Select an operator from EventLog Overview for more details
                    </template>
                </h5></div>
                <div id="operator_event_overview" class="operator_specific_events"></div>
            </div>
        </div>
        <div class="card-columns" style="column-count:1">
             <div id="event_bar_graph_div">
                <svg id="event_timeline"></svg>
            </div><br>
        </div>
    </div>
</div>
<br>
{% endblock %}

{% block scripts %}
{% include "analytics.js" %}
{% endblock %}

{% block body_config %}
/* Add shadow effect to chart. If you don't like it, get rid of it. */
svg {
    -webkit-filter: drop-shadow( 0px 3px 3px rgba(0,0,0,.3) );
    filter: drop-shadow( 0px 3px 3px rgba(0,0,0,.25) );
}

/*Styling for the lines connecting the labels to the slices*/
polyline{
    opacity: .8;
    stroke: {{config['text-color']}};
    stroke-width: 3px;
    fill: none;
    shape-rendering: geometricPrecision;
}

/* styling for the donut slices*/
path {
    shape-rendering: geometricPrecision;
}

/* Make the percentage on the text labels bold*/
.labelName tspan {
    font-style: normal;
    font-weight: 700;
}

/* In biology we generally italicise species names. */
.labelName {
    font-size: 1rem;
    font-style: italic;
}
.y-axis line, .y-axis path, .y-axis text{
    fill: {{config['text-color']}}
}
.x-axis path, .x-axis line, .x-axis text{
    fill: {{config['text-color']}}
}
.tick line{
    stroke: grey
}
/* D3 Donut Code from: https://bl.ocks.org/mbhall88/b2504f8f3e384de4ff2b9dfa60f325e2
MIT License

Copyright (c) 2017 Michael Hall

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

*/
{% endblock %}
